home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_096 / tek4695 / init.asm < prev    next >
Assembly Source File  |  1992-05-06  |  3KB  |  143 lines

  1. ;
  2. ;    Excerpt from Amiga ROM Kernel Reference Manual: Libraries and 
  3. ;    Devices.  Used by permission, 1987, Phil Staub.
  4. ;
  5. ;**************************************************************************
  6. ;                                                                         *
  7. ;    Copyright 1985, Commodore-Amiga Inc. All rights reserved.         *
  8. ;    No part of this program may be reproduced, transmitted            *
  9. ;    transcribed, stored in retrieval system, or translated into       *
  10. ;    any language or computer language, in any form or by any means,   *
  11. ;    electronic, mechanical, magnetic, optical, chemical,              *
  12. ;    manual or ohterwise, without the prior written permission of      *
  13. ;    Commodore-Amiga Incorporated, 983 University Ave. Building #D,    *
  14. ;    Los Gatos, California, 95030                                      *
  15. ;                                                                         *
  16. ;**************************************************************************
  17.     section    printer
  18.  
  19. ;    included files
  20.  
  21.     include    "exec/types.i"
  22.     include    "exec/nodes.i"
  23.     include    "exec/lists.i"
  24.     include    "exec/memory.i"
  25.     include    "exec/ports.i"
  26.     include    "exec/libraries.i"
  27.  
  28.     include    "macros.i"
  29.  
  30. ;    imported functions
  31.  
  32.     XREF_EXE    CloseLibrary
  33.     XREF_EXE    OpenLibrary
  34.     XREF        _AbsExecBase
  35.  
  36.     XREF        _PEDData
  37.  
  38. ;    exported globals
  39.  
  40.     XDEF    _Init
  41.     XDEF    _Expunge
  42.     XDEF    _Open
  43.     XDEF    _Close
  44.     XDEF    _PD
  45.     XDEF    _PED
  46.     XDEF    _SysBase
  47.     XDEF    _DOSBase
  48.     XDEF    _GfxBase
  49.     XDEF    _IntuitionBase
  50.  
  51. ;***********************************************
  52.     section    printer,data
  53. _PD        DC.L    0
  54. _PED        DC.L    0
  55. _SysBase    DC.L    0
  56. _DOSBase    DC.L    0
  57. _GfxBase    DC.L    0
  58. _IntuitionBase    DC.L    0
  59. ;***********************************************
  60.     section    printer,code
  61. _Init:
  62.     move.l    4(a7),_PD
  63.     lea    _PEDData(pc),a0
  64.     move.l    a0,_PED
  65.     move.l    a6,-(a7)
  66.     move.l    _AbsExecBase,a6
  67.     move.l    a6,_SysBase
  68.  
  69. ;    open the dos library
  70.     lea    DLName(pc),a1
  71.     moveq    #0,d0
  72.     CALLEXE    OpenLibrary
  73.     move.l    d0,_DOSBase
  74.     beq.l    initDLErr
  75.  
  76. ;    open the graphics library
  77.     lea    GLName(pc),a1
  78.     moveq    #0,d0
  79.     CALLEXE    OpenLibrary
  80.     move.l    d0,_GfxBase
  81.     beq.l    initGLErr
  82.  
  83. ;    open the intuition library
  84.     lea    ILName(pc),a1
  85.     moveq    #0,d0
  86.     CALLEXE    OpenLibrary
  87.     move.l    d0,_IntuitionBase
  88.     beq.l    initILErr
  89.  
  90.     moveq    #0,d0
  91.  
  92. pdiRTS:
  93.     move.l    (a7)+,a6
  94.     rts
  95.  
  96. initPAErr:
  97.     move.l    _IntuitionBase,a1
  98.     LINKEXE    CloseLibrary
  99.  
  100. initILErr:
  101.     move.l    _GfxBase,a1
  102.     LINKEXE    CloseLibrary
  103.  
  104. initGLErr:
  105.     move.l    _DOSBase,a1
  106.     LINKEXE    CloseLibrary
  107.  
  108. initDLErr:
  109.     moveq    #-1,d0
  110.     bra.s    pdiRTS
  111.  
  112. ILName:
  113.     dc.b    'intuition.library'
  114.     dc.b    0
  115. DLName:
  116.     dc.b    'dos.library'
  117.     dc.b    0
  118. GLName:
  119.     dc.b    'graphics.library'
  120.     dc.b    0
  121.     ds.w    0
  122.  
  123. ;
  124. _Expunge:
  125.     move.l    _IntuitionBase,a1
  126.     LINKEXE    CloseLibrary
  127.  
  128.     move.l    _GfxBase,a1
  129.     LINKEXE    CloseLibrary
  130.  
  131.     move.l    _DOSBase,a1
  132.     LINKEXE    CloseLibrary
  133.  
  134. _Open:
  135.     moveq    #0,d0
  136.     rts
  137.  
  138. _Close:
  139.     moveq    #0,d0
  140.     rts
  141.  
  142.     end
  143.